package com.pengweiwei.androidzygote.goods;

import androidx.databinding.Bindable;
import androidx.databinding.Observable;
import androidx.databinding.PropertyChangeRegistry;

import com.pengweiwei.androidzygote.BR;

import java.io.Serializable;
import java.util.List;

/**
 * Created by Donald Peng on 2018/4/10.
 */

public class CommentBean implements Serializable, Observable {

    /**
     * comment_id : 133
     * goods_id : 1
     * email : www.99soubao.com
     * username : 嫦娥
     * content : 晒单给大家看看.我刚买的.
     * add_time : 1457746625
     * ip_address : 127.0.0.1
     * is_show : 1
     * parent_id : 0
     * user_id : 1
     * img :
     * order_id : 1
     * deliver_rank : 5
     * goods_rank : 2
     * service_rank : 1
     * zan_num : 0
     * zan_userid :
     * is_anonymous : 1
     */

    private int comment_id;
    private int goods_id;
    private String email;
    private String username;
    private String content;
    private int add_time;
    private String ip_address;
    private int is_show;
    private int parent_id;
    private int user_id;
    private String img;
    private int order_id;
    private int deliver_rank;
    private int goods_rank;
    private int service_rank;
    private int zan_num;
    private String zan_userid;
    private int is_anonymous;

    @Bindable
    public List<String> getImages() {
        return images;
    }

    public void setImages(List<String> images) {
        this.images = images;
        notifyChange(BR.images);
    }

    private List<String> images;
    private transient PropertyChangeRegistry propertyChangeRegistry = new PropertyChangeRegistry();

    @Bindable
    public int getComment_id() {
        return comment_id;
    }

    public void setComment_id(int comment_id) {
        this.comment_id = comment_id;
        notifyChange(BR.comment_id);
    }

    @Bindable
    public int getGoods_id() {
        return goods_id;
    }

    public void setGoods_id(int goods_id) {
        this.goods_id = goods_id;
        notifyChange(BR.goods_id);
    }

    @Bindable
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
        notifyChange(BR.email);
    }

    @Bindable
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
        notifyChange(BR.username);
    }

    @Bindable
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
        notifyChange(BR.content);
    }

    @Bindable
    public int getAdd_time() {
        return add_time;
    }

    public void setAdd_time(int add_time) {
        this.add_time = add_time;
        notifyChange(BR.add_time);
    }

    @Bindable
    public String getIp_address() {
        return ip_address;
    }

    public void setIp_address(String ip_address) {
        this.ip_address = ip_address;
        notifyChange(BR.ip_address);
    }

    @Bindable
    public int getIs_show() {
        return is_show;
    }

    public void setIs_show(int is_show) {
        this.is_show = is_show;
        notifyChange(BR.is_show);
    }

    @Bindable
    public int getParent_id() {
        return parent_id;
    }

    public void setParent_id(int parent_id) {
        this.parent_id = parent_id;
        notifyChange(BR.parent_id);
    }

    @Bindable
    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
        notifyChange(BR.user_id);
    }

    @Bindable
    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
        notifyChange(BR.img);
    }

    @Bindable
    public int getOrder_id() {
        return order_id;
    }

    public void setOrder_id(int order_id) {
        this.order_id = order_id;
        notifyChange(BR.order_id);
    }

    @Bindable
    public int getDeliver_rank() {
        return deliver_rank;
    }

    public void setDeliver_rank(int deliver_rank) {
        this.deliver_rank = deliver_rank;
        notifyChange(BR.deliver_rank);
    }

    @Bindable
    public int getGoods_rank() {
        return goods_rank;
    }

    public void setGoods_rank(int goods_rank) {
        this.goods_rank = goods_rank;
        notifyChange(BR.goods_rank);
    }

    @Bindable
    public int getService_rank() {
        return service_rank;
    }

    public void setService_rank(int service_rank) {
        this.service_rank = service_rank;
        notifyChange(BR.service_rank);
    }

    @Bindable
    public int getZan_num() {
        return zan_num;
    }

    public void setZan_num(int zan_num) {
        this.zan_num = zan_num;
        notifyChange(BR.zan_num);
    }

    @Bindable
    public String getZan_userid() {
        return zan_userid;
    }

    public void setZan_userid(String zan_userid) {
        this.zan_userid = zan_userid;
        notifyChange(BR.zan_userid);
    }

    @Bindable
    public int getIs_anonymous() {
        return is_anonymous;
    }

    public void setIs_anonymous(int is_anonymous) {
        this.is_anonymous = is_anonymous;
        notifyChange(BR.is_anonymous);
    }

    private void notifyChange(int propertyId) {
        if (propertyChangeRegistry == null) {
            propertyChangeRegistry = new PropertyChangeRegistry();
        }
        propertyChangeRegistry.notifyChange(this, propertyId);
    }

    @Override
    public void addOnPropertyChangedCallback(OnPropertyChangedCallback callback) {
        if (propertyChangeRegistry == null) {
            propertyChangeRegistry = new PropertyChangeRegistry();
        }
        propertyChangeRegistry.add(callback);

    }

    @Override
    public void removeOnPropertyChangedCallback(OnPropertyChangedCallback callback) {
        if (propertyChangeRegistry != null) {
            propertyChangeRegistry.remove(callback);
        }
    }
}
